package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 平台角色类型(1-商家端，2-商户端)
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum RoleTypeEnum {

    BUSINESS(1, "商家端"),
    MERCHANT(2, "商户端"),
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    RoleTypeEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static RoleTypeEnum typeOfValue(Integer value) {
        RoleTypeEnum[] values = RoleTypeEnum.values();
        for (RoleTypeEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static RoleTypeEnum typeOfName(String name) {
        RoleTypeEnum[] values = RoleTypeEnum.values();
        for (RoleTypeEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
